<div class="page-bar">
    <ul class="page-breadcrumb">
        <li>
            <a href="#">WMS</a>
            <i class="fa fa-circle"></i>
        </li>
        <li>
            <a href="#">Outbound</a>
            <i class="fa fa-circle"></i>
        </li>
        <li>
            <a ui-sref="#">Shipment Ticket</a>
        </li>
    </ul>
</div>

<div class="portlet light bordered order-list-container" style="margin: 15px;">
    <div class="portlet-title">
        <div class="caption">
            <span class="caption-subject bold"> Shipment Ticket List </span>
        </div>

    </div>
    <div class="portlet-body form form-horizontal">
        <form name="editForm" class="form-horizontal">
            <div class="form-group">
                <div class="col-md-3">
                    <label>ID:</label>
                    <lt-tags-input placeholder="Enter ID" ng-model="shipmentTicket.ids" fill="DN-" ng-keyup="keyUpSearch($event)"></lt-tags-input>
                </div>
                <div class="col-md-3">
                    <label>Order ID:</label>
                    <lt-tags-input placeholder="Enter Order ID" ng-model="shipmentTicket.orderIds" fill="DN-" ng-keyup="keyUpSearch($event)"></lt-tags-input>
                </div>
                <div class="col-md-3">
                    <label>Load ID:</label>
                    <lt-tags-input placeholder="Enter Load ID" ng-model="shipmentTicket.loadIds" fill="LOAD-" ng-keyup="keyUpSearch($event)"></lt-tags-input>
                </div>
                <div class="col-md-3">
                    <label>Status:</label>
                    <ui-select multiple name="status" ng-model="shipmentTicket.statuses">
                        <ui-select-match>
                            {{$item}}
                        </ui-select-match>
                        <ui-select-choices repeat="item in statusList| filter: $select.search">
                            {{item}}
                        </ui-select-choices>
                    </ui-select>
                </div>
            </div>
            <div class="form-group">
                <div class="col-md-3">
                    <label>Customer:</label>
                    <multiple-organization-auto-complete name="customer" ng-model="shipmentTicket.customerIds" tag="Customer"></multiple-organization-auto-complete>
                </div>
                <div class="col-md-3">
                    <label>DC Send Status:</label>
                    <ui-select name="tags" ng-model="shipmentTicket.dcSendStatus">
                        <ui-select-match allow-clear="true">
                            <div ng-bind="$select.selected.name"></div>
                        </ui-select-match>
                        <ui-select-choices repeat="statu.dbName as statu in dcSendStatuses| filter: $select.search">
                            {{statu.name}}
                        </ui-select-choices>
                    </ui-select>
                </div>
                <div class="col-md-3">
                        <label>Create Time From</label>
                        <lt-date-time value="shipmentTicket.createdWhenFrom" date-format="yyyy-mm-dd" min-view="2"></lt-date-time>
                    </div>
                    <div class="col-md-3">
                        <label>Create Time To</label>
                        <lt-date-time value="shipmentTicket.createdWhenTo" date-format="yyyy-mm-dd" min-view="2"></lt-date-time>
                    </div>
            </div>
            <div class="form-group form-actions right" style="padding: 0px;">
                <waitting-btn type="button" btn-class="btn yellow" ng-click="export()" value="'Export'" is-loading="exporting"></waitting-btn>
                <waitting-btn type="button" btn-class="btn blue" ng-click="searchShippmentTicket()" value="'Search'" is-loading="loading"></waitting-btn>
                <!-- <button type="submit" class="btn blue" style="float:right;" ng-click="searchShippmentTicket()">Search</button> -->
            </div>
        </form>
        <div class="table-scrollable">
            <table class="table table-striped table-bordered table-hover">
                <thead>
                    <tr>
                        <th ng-repeat="col in colDefs track by $index" class="{{getSortClass($index)}}" ng-click="sortClick($index)">
                            {{col.headerName}}
                        </th>
                        <th>Action</th>
                    </tr>
                </thead>
                <tbody>
                    <tr ng-repeat="item in shipmentTickets">
                        <td>
                            <a ng-href="{{'#/wms/outbound/shipment-ticket/' + item.id}}" target="_blank">{{item.id}}</a>
                        </td>
                        <td>
                            <a ng-href="{{'#/wms/outbound/order/' + item.orderId}}" target="_blank">{{item.orderId}}</a>
                        </td>
                        <td>
                            <a ng-href="{{'#/wms/outbound/load/' + item.loadId}}" target="_blank">{{item.loadId}}</a>
                        </td>
                        <td>{{item.customerName}}</td>
                        <td>{{item.masterBolNo}}</td>
                        <td>{{item.status}}</td>
                        <td>{{item.dcSendStatus?'Yes':'No'}}</td>
                        <td>{{item.loadedSlpIds}}</td>
                        <td>{{item.createdBy}}</td>
                        <td>{{item.updatedBy}}</td>
                        <td>{{item.createdWhen | amDateFormat:'YYYY-MM-DD HH:mm:ss'}}</td>
                        <td>{{item.closedWhen | amDateFormat:'YYYY-MM-DD HH:mm:ss'}}</td>
                        <td >
                            <waitting-btn permission-check="{{'edi::sendDc_write'}}" ng-if="item.dcSent === 'No'" type="button" btn-class="btn blue" ng-click="sendDC(item.id,item.orderId)" value="'Send DC'"
                                is-loading="isSendingDC[item.id]"></waitting-btn>
                            <waitting-btn permission-check="{{'edi::resendDc_write'}}" ng-if="item.dcSent === 'Yes'" type="button" btn-class="btn red" ng-click="resendDC(item.id,item.orderId)" value="'Resend DC'"
                                is-loading="isResendingDC[item.id]"></waitting-btn>
                        </td>
                    </tr>
                </tbody>
            </table>
        </div>
        <pager total-count="paging.totalCount" current-page ="paging.pageNo" page-size="pageSize" load-content="loadContent(currentPage)"></pager>
    </div>
</div>